package com.ywk.base.designPattern.observer.jdkObserver;

import java.util.Observable;
import java.util.Observer;

/**
 * @Author zbh
 * @Date 2023/4/3
 */
public class People implements Observer {
    private String name;

    public People(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        Float price = (Float) arg;
        System.out.println("观察者" + name + "房子价格变了：" + price);
        if (price > 20000) {
            System.out.println("update:"+ "太TM贵啦，不关注了！");
            o.deleteObserver(this);
        }
    }
}
